<?php
/**
* @file media_db_listme.php
* @version 0.0.2
* @package Media_db
* @copyright Copyright (C) 2006 Nikolai Plath. All rights reserved
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
///////////
// Listendarstellung
////////////
function ListMe ( $kats, $medias, $mdb_acclevel ) {
global $mdb_acclevel, $mdbPrefs;
global $mosConfig_live_site;
	echo '<h1 align="center" class="mdb_outlinebox">Einstellungen</h1>';
   echo '<table class="medialist">
  <th>&nbsp;</th><th>&nbsp;</th><th>ID</th><th>Media</th><th>Gruppe</th><th>Titel</th><th>Jahr</th>';
  $i = 0;
   foreach ( $medias as $media ) {
		$i=1-$i;
		echo '
		<tr class="row'.$i.'">
			<td>';
         //Bearbeiten nur ACC_Level 3
			if ( $mdb_acclevel == 4 ) echo "#".$media->id."#";
			if ( $mdb_acclevel >= 3 ) {
         	echo '<a href="'.$mosConfig_live_site.'/index.php?option=com_media_db&akto=media_edit&edid='.$media->id.'" alt="Bearbeiten" title="Bearbeiten">
				<img src="'.$mosConfig_live_site.'/includes/js/ThemeOffice/edit_1.png" border="0" alt="Bearbeiten"/>
				</a>';
         }
			else echo '&nbsp;';
			//Ansehen alle ACC_Level
         //echo '<a href="index.php?option=com_media_db&akto=showcase&showid='.$media->id.'" alt="Ansehen" title="Ansehen">-S-</a>';


			echo '
         </td>
			<td>';
			mdbComposeTooltip ($media, $kats);
			echo '
			</td>
			<td>'.$media->unique_id.'</td>
         <td>'.$kats[$media->id_kat-1]->name.'</td>
     		<td>'.mdb_format_cut($media->gruppe, 30).'</td>
         <td>'.mdb_format_cut($media->titel, 30).'</td>
         <td>'.$media->jahr.'</td>
		</tr>';
  }
  echo '</table>';
}

function mdbComposeTooltip ( $media, $kats ) {
global $mdbPrefs;
global $mosConfig_live_site;
$ttb_hoch = $mdbPrefs[0]->ttbild_hoch;
$ttb_breit = $mdbPrefs[0]->ttbild_breit;
//static $dietestval;

  $tt_href = $mosConfig_live_site . "/index.php?option=com_media_db&amp;akto=showcase&amp;showid=".$media->id;
  $tttitel = "Zum Ansehen klicken<br />";
  $tttext = "<strong>".$media->gruppe." - ".$media->titel."</strong><br />Nummer: #".$media->unique_id."<br />".$kats[$media->id_kat-1]->name." - ".$media->jahr."<br />";
  $tttext .= "<table><tr>";
		if ($media->bildpfad) {
		  $picpath = $mosConfig_live_site."/images/stories/dsk_covers/".$media->bildpfad;
		  $tttext .= "<td><hr /><img src=&quot;$picpath&quot width=&quot;".$ttb_breit."px&quot; height=&quot;".$ttb_hoch."px&quot; /><hr /></td>";
		}

  $tttext .= '<td><table>';
  
  //					if ( $mdb_acclevel >= 1 ) {
  $tttext .= '<tr><th>Vertrieb</th><td>'.$media->vertrieb.'</td></tr>'
  .'<tr><th>Produzent</th><td>'.$media->produzent.'</td></tr>'
  .'<tr><th>Identit&auml;tsnummer</th><td>'.$media->itaenr.'</td></tr>'
  .'<tr><th>Bestellnummer</th><td>'.$media->bestnr.'</td></tr>'
  .'<tr><th>Bearbeiter</th><td>'.$media->bearbeiter.'</td></tr>'
  .'<tr><th>Arrangeur</th><td>'.$media->arrangeur.'</td></tr>';
//					}  
//					if ( $mdb_acclevel >= 1 ) {
	$tttext .= '<tr><th>Erstellt am</th><td>'.mdb_reorderDate($media->created).'</td></tr>'
	.'<tr><th>von</div></th><td>'.$media->created_by.'</td></tr>'
	.'<tr><th>Ge&auml;ndert am</th><td>'.mdb_reorderDate($media->modified).'</td></tr>'
	.'<tr><th>von</th><td>'.$media->modified_by.'</td></tr>';
//					}  

  $tttext .= '</table></td></tr></table>';
//  $tttext = htmlspecialchars($tttext, ENT_QUOTES);
//if ($dietestval != 9) echo "<!-- gugugugu $tttext -->";
//$dietestval = 9;
	echo mosToolTip ($tttext, $tttitel, '', 'preview_1.png', '', $tt_href);
}

?>